import { ref } from "vue";

export default function InitHook() {
  const formState = ref<Array<Base.GeneraDataType>>([]);
  const loading = ref<boolean>(false);
  const config = {
    className: "htCenter"
    //   beforeChange: (changes: any) => {
    //     // [[row, prop, oldVal, newVal], ...]
    //     for (let i = 0; i < changes.length; i++) {
    //       const target = changes[i];
    //       if (["boxWeight", "boxLength", "boxWidth", "boxHeight"].includes(target[1])) {
    //         if (changes[i][3].length > 5) {
    //           changes[i][3] = changes[i][3].slice(0, 5);
    //         }
    //         if (isNaN(Number(target[3]))) {
    //           changes[i][3] = 0;
    //         } else {
    //           changes[i][3] = Number(changes[i][3]).toFixed(2);
    //         }
    //       }
    //     }
    //   }
  };
  return {
    formState,
    config,
    loading
  };
}
